<?php

namespace Wonfu\Core;

use DI\Container;
use Symfony\Component\Console\Application;

class Command
{
    /**
     * @var Container
     */
    private $container;

    /**
     * @var Application
     */
    private $application;


    public function __construct()
    {
        $this->application = new Application();
    }


    /**
     * @return Container
     */
    public function getContainer(): Container
    {
        return $this->container;
    }

    /**
     * @param Container $container
     */
    public function setContainer(Container $container): void
    {
        $this->container = $container;
    }


    public function add(\Symfony\Component\Console\Command\Command $command)
    {
        $this->container->injectOn($command);
        $this->application->add($command);
    }


    public function run()
    {
        $this->application->run();
    }

}